package casa.depesos.app.com.http.req;


import casa.depesos.app.com.http.HttpReq;
import casa.depesos.app.com.http.Req;
import casa.depesos.app.com.http.ReqCallback;
import casa.depesos.app.com.http.bean.MeBean;
import casa.depesos.app.com.http.bean.WhiteDataBean;
import casa.depesos.app.com.http.parser.MeParser;
import casa.depesos.app.com.utils.Constant;
import okhttp3.FormBody;

public class MyInfoReq implements HttpReq<MeBean> {
    @Override
    public void req(ReqCallback<MeBean> callback) {//   /app/cust/queryCustInfo
        FormBody.Builder builder = new FormBody.Builder();
        Req.post("/app/professionalData/fetchClientProfile", getParam(), getHeader(), builder.build(), new MeParser(), callback, this);
    }

    public MeBean req() {
        if (Constant.white) {
            MeBean bean = new MeBean();
            WhiteDataBean tmp = new GetWhiteReq().req();
            if (tmp == null || !tmp.isValid()) {
                return null;
            }
            bean.info = tmp.getData().me;
            return bean;
        } else {
            FormBody.Builder builder = new FormBody.Builder();
            try {
                return Req.post("/app/professionalData/fetchClientProfile", getParam(), getHeader(), builder.build(), new MeParser(), this);
            } catch (Throwable e) {
                e.printStackTrace();
                return null;
            }
        }
    }
}
